<%@page import="java.util.Calendar"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.hahehiho.myalbum.MyAlbumVO"%>
<%@page import="com.hahehiho.myalbum.MyAlbumDB"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,width=device-width" />
<title>MyAlbum</title>
<link rel="stylesheet" href="css/default.css" >
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>

</head>
<%
request.setCharacterEncoding("UTF-8");

String pkey = request.getParameter("pkey");
String xptitle = request.getParameter("xptitle");
String xpsubject = request.getParameter("xpsubject");
String xpkeywords = request.getParameter("xpkeywords");
String xpcomment = request.getParameter("xpcomment");
String orgdate = request.getParameter("orgdate");

String latitude = request.getParameter("latitude");
String longitude = request.getParameter("longitude");

String filepath = request.getParameter("filepath");

System.out.println(orgdate);
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
cal.setTime(sdf.parse(orgdate));

MyAlbumDB db = MyAlbumDB.getInstance();
MyAlbumVO vo = new MyAlbumVO();
vo.setpKey(Integer.parseInt(pkey));
vo.setXpTitle(xptitle);
vo.setXpSubject(xpsubject);
vo.setXpKeywords(xpkeywords);
vo.setXpComment(xpcomment);
vo.setOrgDate(cal);
vo.setLatitude(Double.parseDouble(latitude));
vo.setLongitude(Double.parseDouble(longitude));
vo.setIsGPS(true);
vo.setFilePath(filepath);

System.out.println(xptitle);

boolean result = db.updatePhoto(vo);

%>
<body>
<%
if(result){ 
%>
Success.
<% 
} else {
%>
Fail.
<%
}
%>
</body>
</html>